package com.xk.demo.organ.service.impl;

import com.xk.demo.mybatis.entity.PtOrganEntity;
import com.xk.demo.mybatis.entity.PtUserEntity;
import com.xk.demo.mybatis.flexigrid.PadingRstType;
import com.xk.demo.mybatis.flexigrid.PagingBean;
import com.xk.demo.organ.entity.OrganSearchEntity;
import com.xk.demo.organ.mapper.OrganDao;
import com.xk.demo.organ.service.OrganService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author qinmiao
 * @className OrganServiceImpl
 * @description TODO
 * @date 2022.05.18 21:31
 */
@Service("organService")
public class OrganServiceImpl implements OrganService {
    @Resource
    private OrganDao organDao;
    @Override
    public PadingRstType<PtOrganEntity> getOrganInfoListByPage(OrganSearchEntity search, PagingBean paging) {
        paging.deal(PtOrganEntity.class);
        PadingRstType<PtOrganEntity> padingRstType = new PadingRstType<>();
        padingRstType.setPage(paging.getPage());
        List<PtOrganEntity> list=organDao.getOrganInfoListByPage(search,paging);
        Integer total = organDao.queryOrganListTotal(search);
        padingRstType.setRawRecords(list);
        padingRstType.setTotal(total);
        padingRstType.putItems();
        return padingRstType;
    }

    @Override
    public void bindOrganStructure(String organUuid, String parentUuid) {
        organDao.bindOrganStructure(organUuid,parentUuid);
    }
    @Override
    public void unbindOrganStructure(String organUuid, String parentUuid) {
        organDao.unbindOrganStructure(organUuid,parentUuid);
    }

}
